package com.ysg.binding.viewadapter;

import androidx.databinding.BindingAdapter;

import com.ysg.binding.command.BindingCommand;
import com.ysg.widget.code.YCode;

public class CodeViewAdapter {

    @BindingAdapter(value = {"onCodeCommand"}, requireAll = false)
    public static void setOnCodeCommand(final YCode code, BindingCommand<Boolean> bindingCommand) {
       code.setOnCodeClickListener(new YCode.OnCodeClickListener() {
           @Override
           public void onCodeClick() {
               if (bindingCommand != null){
                   bindingCommand.execute();
               }
           }
       });
    }
}
